{template header}

<style type="text/css">

    body{ background-color: #fff; }

    .sfz_box img{ max-height: 167px; }

</style>



<body>

    <!-- S header -->

    <header class="alliance_details_header">

        <a href="javascript:;" onClick="javascript :history.back(-1);" class="headerL iconfont">&#xe66a;</a>

        <h1>微信绑定</h1>

    </header>

    <!-- E header -->

    <form class="registerform" action="{U('User/user/weixin')}" method="post" >

    <ul class="change_num_box">

        <li class="flex">

            <label class="label">微信账号</label>

            <div class="flex-1 input_box"><input type="text" name="weixin" value="<?php echo $this->userinfo['weixin'];?>"  placeholder="请输入您的微信账号" datatype="*"  nullmsg='请输入您的微信账号' ></div>

            <input type="hidden" name="weixin_qr" id="pic1"  value="<?php echo $this->userinfo['weixin_qr'];?>" >

        </li>

    </ul>

    </form>



    <dl class="uploading_box">

        <dt>上传微信收款二维码</dt>

        <dd id="img1_box">

            <img src="<?php echo $this->userinfo['weixin_qr']==""?"/template/wap/statics/images/uploading.png":$this->userinfo['weixin_qr'];?>" alt="" width="" class="uploading_img">

            <input type="file" id="file_up" name="上传" style="display:none;"/>

        </dd>

    </dl>



    <a href="javascript:;" class="service_affirm_btn"  onclick="submitForm();">确认</a>

</body>







<link href="/statics/js/webuploader/webuploader.css" rel="stylesheet" />

<script src="/statics/js/webuploader/webuploader.js" type="text/javascript"></script>

<script type="text/javascript">





    var img1 = new WebUploader.create({

        auto:true,

        fileVal:'upfile',

        // swf文件路径

        swf: '/statics/js/webuploader/webuploader.swf',

        // 文件接收服务端。

        server: "/index.php?m=attachment&c=upload&a=swfupload",

        // 选择文件的按钮。可选

        formData:{

            "module":"",

            "catid":"",

            "userid":"1",

            "dosubmit":"1",

            "thumb_width":"0",

            "thumb_height":"0",

            "watermark_enable":"1",

            "filetype_post":"jpg|jpeg|gif|bmp|png",

            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",

            "isadmin":"1"

        },

        // 内部根据当前运行是创建，可能是input元素，也可能是flash.

        pick: {

            id: '#img1_box',

            multiple:false

        },

        accept:{

            title: '图片文件',

            extensions: 'gif,jpg,jpeg,bmp,png',

            mimeTypes: 'image/*'

        },

        thumb:{

            width: '110',

            height: '110',

        },

        chunked: false,

        chunkSize:1000000,

        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！

        resize: false

    });

    img1.onUploadSuccess = function( file, response ) {

        var pickid = this.options.pick.id;

        var data = response._raw;

        var arr = data.split(',');

        if(response.url.length > 0) {

            $(pickid).find('img').attr('src', response.url);

            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);

            $("#pic1").attr('value', response.url);

        }

        console.log(response);

    }

    img1.onUploadError = function(file, reason) {

        hd_alert('文件上传错误：' + reason);

    }





    var inx;

    function submitForm(){

        layer.open({type: 2});

        $(".registerform").submit();





    }





    $(".registerform").Validform({

            tiptype:function(msg,o,cssctl){



                if(o.type==3){

                    layer.closeAll();

                    //$(".errmsg").text(msg).show();

                    tips(msg);

                    return false;

                }

                if(o.type==1){

                    o.obj.addClass("Validform_success")

                }

            },

            ajaxPost: true,

            callback: function(ret) {

                layer.closeAll();

                if (ret.status == 0) {

                    //$(".errmsg").text(ret.info).show();

                    tips(ret.info);

                } else {

                    layer.open({

                        content: ret.info

                        ,skin: 'msg'

                        ,time: 2

                        ,end:function(){

                            location.href = "{U('user/index/setting')}";

                        }

                    });

                }

            }

    });







</script>

</html>